/*
XCommander Extension
http://www.xcommander.ch/
*/

function XCommanderMessageServer() {

}

XCommanderMessageServer.prototype = {
	_eventListener : new XCommanderEventListener(),
	_onMessage : function(request, type, data, callback) {
		var message = {
			'type' : type,
			'data' : data,
			sendResponse : function(data) {
				xcommander.lib.browser.postMessage(request, data, callback);
			}
		};
		this._eventListener.fireEvent(message);
	},
	addMessageListener : function(type, callback) {
		return this._eventListener.addEventListener(type, callback);
	},
	removeMessageListener : function(type, callback) {
		return this._eventListener.removeEventListener(type, callback);
	}
};
